package hz;

/**
 * Created by hz on 2017/1/3.
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

/** * Created by GWCheng on 2015/12/29. */
public class Setting { private static Properties _prop = new Properties(); /** * 读取配置文件 * @param fileName */
public static void readProperties(String fileName){
    try {
    InputStream in = Setting.class.getResourceAsStream("/"+fileName);
    BufferedReader bf = new BufferedReader(new InputStreamReader(in));
    _prop.load(bf);
    }catch (IOException e){
    e.printStackTrace();
     }
     }
/** * 根据key读取对应的value * @param key * @return */
public static String getProperty(String key){
    System.out.println("hello");
    return _prop.getProperty(key);
    }

    public static void main(String[] args) {
        Setting.readProperties("default1.properties");
    }
}